package com.ruoyi.flink.dataSet.java;


import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.configuration.Configuration;

/**
 * @program: ruoyi
 * @description: 读取文件
 * @author: zengchen
 * @create: 2020-11-09 21:13
 **/
public class SourceExample {
    public static void main(String[] args) throws Exception {
        final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
        readPath(env);  // 递归文件夹读取

    }

    // 递归文件夹读取
    private static void readPath(ExecutionEnvironment env) throws Exception {
        Configuration parameters = new Configuration();
        parameters.setBoolean("recursive.file.enumeration", true);
        DataSet<String> lines = env.readTextFile("D:\\gitee\\study_imooc\\test-data\\flink\\digui")
                .withParameters(parameters);
        lines.print();
    }


}
